package com.yun.service;

import com.yun.entity.User;
import com.yun.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: fxy
 * @Date: 2023/03/23/14:07
 * @Description:
 */
@Service
@Slf4j
public class UserService {

	@Resource
	private UserMapper userMapper;

	@Transactional
	public List<User> selectUsers(){
		List<User> users = userMapper.selectUser();
		return users;
	}

	@Transactional(rollbackFor = Exception.class)
	public List<User> selectMapper2Users(){
		List<User> users = userMapper.selectUser();
		List<User> users1 = userMapper.selectUser();
		return users;
	}
}
